import csv

def cat_report():
    food = 0
    other = 0
    transport = 0
    wear = 0
    press = 0
    with open('DATA.csv') as csvfile:
        for list_data in csv.reader(csvfile):
            if list_data[1] == "food":
                food += float(list_data[2])
            elif list_data[1] == "other":
                other += float(list_data[2]) 
            elif list_data[1] == "transport":
                transport += float(list_data[2])
            elif list_data[1] == "wear":
                wear += float(list_data[2])
            elif list_data[1] == "press":
                press += float(list_data[2])
    data = f"food;{food}\nother;{other}\ntransport;{transport}\nwear;{wear}\npress{press}\n"
    with open('REPORT.csv', 'w', newline='') as csvfile:
        csvfile.write(data)

cat_report()
with open('REPORT.csv') as csvfile:
    reader = csv.reader(csvfile)
    cat_dict = {}
    for line in reader:
        key, value = line[0].split(';')
        cat_dict[key] = float(value)
assert cat_dict == {'food': 295.03000000000003,
                    'other': 50.64,
                    'press': 164.60999999999999,
                    'transport': 282.96999999999997,
                    'wear': 366.9}
'решение зачтено'